<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
        <div id="div">
            查看执行结果
        </div>
        <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
        <script>
            $(function () {
                $('#div').click(function(){
                    console.log(53);
                    //定时器
                    setInterval(getData, 30 * 1000);

                });

                /**
                 *  获取数据
                 */
                function getData(){
                    $.post(
                        'http://tp5.com/get_ping',
                        function(res){

                            var dataObj = JSON.parse(res);

                            $('#div').html(dataObj.data);
                        }
                    );
                }
            });

        </script>
</body>
</html>